/**
 *
 */
import Util;
import OpenApi;

import EndpointUtil;

extends OpenApi;

init(config: OpenApi.Config){
  super(config);
  @endpointRule = '';
  

  checkConfig(config);
  @endpoint = getEndpoint('logiccomposer', @regionId, @endpointRule, @network, @suffix, @endpointMap, @endpoint);
}

function getEndpoint(productId: string, regionId: string, endpointRule: string, network: string, suffix: string, endpointMap: map[string]string, endpoint: string) throws: string{
  if (!Util.empty(endpoint)) {
    return endpoint;
  }

  if (!Util.isUnset(endpointMap) && !Util.empty(endpointMap[regionId])) {
    return endpointMap[regionId];
  }
  return EndpointUtil.getEndpointRules(productId, regionId, endpointRule, network, suffix);
}
model AbolishFlowRequest {
  flowId?: string(name='FlowId'),
}

model AbolishFlowResponseBody = {
  requestId?: string(name='RequestId'),
}

model AbolishFlowResponse = {
  headers: map[string]string(name='headers'),
  body: AbolishFlowResponseBody(name='body'),
}

async function abolishFlowWithOptions(request: AbolishFlowRequest, runtime: Util.RuntimeOptions): AbolishFlowResponse {
  Util.validateModel(request);
  var req = new OpenApi.OpenApiRequest{ 
    body = Util.toMap(request),
  };
  return doRPCRequest('AbolishFlow', '2018-12-12', 'HTTPS', 'POST', 'AK', 'json', req, runtime);
}

async function abolishFlow(request: AbolishFlowRequest): AbolishFlowResponse {
  var runtime = new Util.RuntimeOptions{};
  return abolishFlowWithOptions(request, runtime);
}

model CloneFlowRequest {
  flowId?: string(name='FlowId'),
  flowVersion?: int32(name='FlowVersion'),
}

model CloneFlowResponseBody = {
  requestId?: string(name='RequestId'),
}

model CloneFlowResponse = {
  headers: map[string]string(name='headers'),
  body: CloneFlowResponseBody(name='body'),
}

async function cloneFlowWithOptions(request: CloneFlowRequest, runtime: Util.RuntimeOptions): CloneFlowResponse {
  Util.validateModel(request);
  var req = new OpenApi.OpenApiRequest{ 
    body = Util.toMap(request),
  };
  return doRPCRequest('CloneFlow', '2018-12-12', 'HTTPS', 'POST', 'AK', 'json', req, runtime);
}

async function cloneFlow(request: CloneFlowRequest): CloneFlowResponse {
  var runtime = new Util.RuntimeOptions{};
  return cloneFlowWithOptions(request, runtime);
}

model CreateFlowRequest {
  name?: string(name='Name'),
  description?: string(name='Description'),
  definition?: string(name='Definition'),
}

model CreateFlowResponseBody = {
  flowId?: string(name='FlowId'),
  requestId?: string(name='RequestId'),
}

model CreateFlowResponse = {
  headers: map[string]string(name='headers'),
  body: CreateFlowResponseBody(name='body'),
}

async function createFlowWithOptions(request: CreateFlowRequest, runtime: Util.RuntimeOptions): CreateFlowResponse {
  Util.validateModel(request);
  var req = new OpenApi.OpenApiRequest{ 
    body = Util.toMap(request),
  };
  return doRPCRequest('CreateFlow', '2018-12-12', 'HTTPS', 'POST', 'AK', 'json', req, runtime);
}

async function createFlow(request: CreateFlowRequest): CreateFlowResponse {
  var runtime = new Util.RuntimeOptions{};
  return createFlowWithOptions(request, runtime);
}

model DeleteFlowRequest {
  flowId?: string(name='FlowId'),
  flowIds?: string(name='FlowIds'),
}

model DeleteFlowResponseBody = {
  requestId?: string(name='RequestId'),
}

model DeleteFlowResponse = {
  headers: map[string]string(name='headers'),
  body: DeleteFlowResponseBody(name='body'),
}

async function deleteFlowWithOptions(request: DeleteFlowRequest, runtime: Util.RuntimeOptions): DeleteFlowResponse {
  Util.validateModel(request);
  var req = new OpenApi.OpenApiRequest{ 
    body = Util.toMap(request),
  };
  return doRPCRequest('DeleteFlow', '2018-12-12', 'HTTPS', 'POST', 'AK', 'json', req, runtime);
}

async function deleteFlow(request: DeleteFlowRequest): DeleteFlowResponse {
  var runtime = new Util.RuntimeOptions{};
  return deleteFlowWithOptions(request, runtime);
}

model DeployFlowRequest {
  flowId?: string(name='FlowId'),
}

model DeployFlowResponseBody = {
  requestId?: string(name='RequestId'),
}

model DeployFlowResponse = {
  headers: map[string]string(name='headers'),
  body: DeployFlowResponseBody(name='body'),
}

async function deployFlowWithOptions(request: DeployFlowRequest, runtime: Util.RuntimeOptions): DeployFlowResponse {
  Util.validateModel(request);
  var req = new OpenApi.OpenApiRequest{ 
    body = Util.toMap(request),
  };
  return doRPCRequest('DeployFlow', '2018-12-12', 'HTTPS', 'POST', 'AK', 'json', req, runtime);
}

async function deployFlow(request: DeployFlowRequest): DeployFlowResponse {
  var runtime = new Util.RuntimeOptions{};
  return deployFlowWithOptions(request, runtime);
}

model DescribeAccountSummaryResponseBody = {
  instanceCount?: long(name='InstanceCount'),
  onlineInstanceCount?: long(name='OnlineInstanceCount'),
  requestId?: string(name='RequestId'),
  invocationCount?: long(name='InvocationCount'),
  dailyInvocationErrorCount?: long(name='DailyInvocationErrorCount'),
}

model DescribeAccountSummaryResponse = {
  headers: map[string]string(name='headers'),
  body: DescribeAccountSummaryResponseBody(name='body'),
}

async function describeAccountSummaryWithOptions(runtime: Util.RuntimeOptions): DescribeAccountSummaryResponse {
  var req = new OpenApi.OpenApiRequest{};
  return doRPCRequest('DescribeAccountSummary', '2018-12-12', 'HTTPS', 'POST', 'AK', 'json', req, runtime);
}

async function describeAccountSummary(): DescribeAccountSummaryResponse {
  var runtime = new Util.RuntimeOptions{};
  return describeAccountSummaryWithOptions(runtime);
}

model DescribeConnectorAttributeRequest {
  connectorName?: string(name='ConnectorName'),
  lang?: string(name='Lang'),
  stepInfo?: string(name='StepInfo'),
}

model DescribeConnectorAttributeResponseBody = {
  description?: string(name='Description'),
  category?: string(name='Category'),
  requestId?: string(name='RequestId'),
  capabilities?: {
    actions?: [ 
      {
        displayName?: string(name='DisplayName'),
        type?: string(name='Type'),
        visibility?: string(name='Visibility'),
        description?: string(name='Description'),
        documentUrl?: string(name='DocumentUrl'),
        name?: string(name='Name'),
        system?: boolean(name='System'),
        defaultActionName?: string(name='DefaultActionName'),
      }
    ](name='Actions'),
    triggers?: [ 
      {
        displayName?: string(name='DisplayName'),
        type?: string(name='Type'),
        visibility?: string(name='Visibility'),
        description?: string(name='Description'),
        documentUrl?: string(name='DocumentUrl'),
        name?: string(name='Name'),
        system?: boolean(name='System'),
      }
    ](name='Triggers'),
  }(name='Capabilities'),
  fullName?: string(name='FullName'),
  displayName?: string(name='DisplayName'),
  regionId?: string(name='RegionId'),
  icon?: {
    type?: string(name='Type'),
    value?: string(name='Value'),
  }(name='Icon'),
  brandColor?: string(name='BrandColor'),
  stepResult?: {
    hasNext?: boolean(name='HasNext'),
  }(name='StepResult'),
  name?: string(name='Name'),
  connectorId?: string(name='ConnectorId'),
}

model DescribeConnectorAttributeResponse = {
  headers: map[string]string(name='headers'),
  body: DescribeConnectorAttributeResponseBody(name='body'),
}

async function describeConnectorAttributeWithOptions(request: DescribeConnectorAttributeRequest, runtime: Util.RuntimeOptions): DescribeConnectorAttributeResponse {
  Util.validateModel(request);
  var req = new OpenApi.OpenApiRequest{ 
    body = Util.toMap(request),
  };
  return doRPCRequest('DescribeConnectorAttribute', '2018-12-12', 'HTTPS', 'POST', 'AK', 'json', req, runtime);
}

async function describeConnectorAttribute(request: DescribeConnectorAttributeRequest): DescribeConnectorAttributeResponse {
  var runtime = new Util.RuntimeOptions{};
  return describeConnectorAttributeWithOptions(request, runtime);
}

model DescribeConnectorCapabilityRequest {
  type?: string(name='Type'),
  lang?: string(name='Lang'),
  preset?: string(name='Preset'),
}

model DescribeConnectorCapabilityResponseBody = {
  connections?: [ 
    {
      definition?: string(name='Definition'),
      connectionName?: string(name='ConnectionName'),
      content?: string(name='Content'),
    }
  ](name='Connections'),
  connector?: {
    displayName?: string(name='DisplayName'),
    defaultPolicy?: [ string ](name='DefaultPolicy'),
    fullName?: string(name='FullName'),
    icon?: {
      type?: string(name='Type'),
      value?: string(name='Value'),
    }(name='Icon'),
    connectorId?: string(name='ConnectorId'),
    regionId?: string(name='RegionId'),
    ramMap?: string(name='RamMap'),
    description?: string(name='Description'),
    brandColor?: string(name='BrandColor'),
    category?: string(name='Category'),
    connectionParameters?: {
      type?: string(name='Type'),
    }(name='ConnectionParameters'),
    name?: string(name='Name'),
  }(name='Connector'),
  type?: string(name='Type'),
  parameters?: [ 
    {
      displayName?: string(name='DisplayName'),
      type?: string(name='Type'),
      placeHolder?: string(name='PlaceHolder'),
      readOnly?: boolean(name='ReadOnly'),
      example?: string(name='Example'),
      defaultValue?: string(name='DefaultValue'),
      subType?: string(name='SubType'),
      enumDisplayName?: [ string ](name='EnumDisplayName'),
      required?: boolean(name='Required'),
      description?: string(name='Description'),
      position?: string(name='Position'),
      enum?: [ string ](name='Enum'),
      subParameters?: [ 
        {
          displayName?: string(name='DisplayName'),
          type?: string(name='Type'),
          required?: boolean(name='Required'),
          name?: string(name='Name'),
        }
      ](name='SubParameters'),
      name?: string(name='Name'),
    }
  ](name='Parameters'),
  requestId?: string(name='RequestId'),
  displayName?: string(name='DisplayName'),
  documentUrl?: string(name='DocumentUrl'),
  visibility?: string(name='Visibility'),
  defaultInputs?: string(name='DefaultInputs'),
  system?: boolean(name='System'),
  name?: string(name='Name'),
  responses?: [ 
    {
      type?: string(name='Type'),
      displayName?: string(name='DisplayName'),
      description?: string(name='Description'),
      expression?: string(name='Expression'),
      example?: string(name='Example'),
      name?: string(name='Name'),
    }
  ](name='Responses'),
}

model DescribeConnectorCapabilityResponse = {
  headers: map[string]string(name='headers'),
  body: DescribeConnectorCapabilityResponseBody(name='body'),
}

async function describeConnectorCapabilityWithOptions(request: DescribeConnectorCapabilityRequest, runtime: Util.RuntimeOptions): DescribeConnectorCapabilityResponse {
  Util.validateModel(request);
  var req = new OpenApi.OpenApiRequest{ 
    body = Util.toMap(request),
  };
  return doRPCRequest('DescribeConnectorCapability', '2018-12-12', 'HTTPS', 'POST', 'AK', 'json', req, runtime);
}

async function describeConnectorCapability(request: DescribeConnectorCapabilityRequest): DescribeConnectorCapabilityResponse {
  var runtime = new Util.RuntimeOptions{};
  return describeConnectorCapabilityWithOptions(request, runtime);
}

model DescribeFlowRequest {
  flowId?: string(name='FlowId'),
  flowVersion?: int32(name='FlowVersion'),
}

model DescribeFlowResponseBody = {
  status?: string(name='Status'),
  flowId?: string(name='FlowId'),
  description?: string(name='Description'),
  requestId?: string(name='RequestId'),
  version?: int32(name='Version'),
  createdAt?: string(name='CreatedAt'),
  definition?: string(name='Definition'),
  editMode?: string(name='EditMode'),
  regionId?: string(name='RegionId'),
  updatedAt?: string(name='UpdatedAt'),
  source?: string(name='Source'),
  name?: string(name='Name'),
}

model DescribeFlowResponse = {
  headers: map[string]string(name='headers'),
  body: DescribeFlowResponseBody(name='body'),
}

async function describeFlowWithOptions(request: DescribeFlowRequest, runtime: Util.RuntimeOptions): DescribeFlowResponse {
  Util.validateModel(request);
  var req = new OpenApi.OpenApiRequest{ 
    body = Util.toMap(request),
  };
  return doRPCRequest('DescribeFlow', '2018-12-12', 'HTTPS', 'POST', 'AK', 'json', req, runtime);
}

async function describeFlow(request: DescribeFlowRequest): DescribeFlowResponse {
  var runtime = new Util.RuntimeOptions{};
  return describeFlowWithOptions(request, runtime);
}

model DescribeFlowMetricRequest {
  flowId?: string(name='FlowId'),
}

model DescribeFlowMetricResponseBody = {
  requestId?: string(name='RequestId'),
  invocationCount?: long(name='InvocationCount'),
  invocationErrorCount?: long(name='InvocationErrorCount'),
  errorRate?: float(name='ErrorRate'),
  costAverage?: long(name='CostAverage'),
}

model DescribeFlowMetricResponse = {
  headers: map[string]string(name='headers'),
  body: DescribeFlowMetricResponseBody(name='body'),
}

async function describeFlowMetricWithOptions(request: DescribeFlowMetricRequest, runtime: Util.RuntimeOptions): DescribeFlowMetricResponse {
  Util.validateModel(request);
  var req = new OpenApi.OpenApiRequest{ 
    body = Util.toMap(request),
  };
  return doRPCRequest('DescribeFlowMetric', '2018-12-12', 'HTTPS', 'POST', 'AK', 'json', req, runtime);
}

async function describeFlowMetric(request: DescribeFlowMetricRequest): DescribeFlowMetricResponse {
  var runtime = new Util.RuntimeOptions{};
  return describeFlowMetricWithOptions(request, runtime);
}

model DescribeFlowTemplateRequest {
  templateId?: string(name='TemplateId'),
}

model DescribeFlowTemplateResponseBody = {
  locale?: string(name='Locale'),
  connector?: string(name='Connector'),
  summaryEn?: string(name='SummaryEn'),
  description?: string(name='Description'),
  requestId?: string(name='RequestId'),
  createdAt?: string(name='CreatedAt'),
  definition?: string(name='Definition'),
  overview?: string(name='Overview'),
  updatedAt?: string(name='UpdatedAt'),
  name?: string(name='Name'),
  summary?: string(name='Summary'),
  tag?: string(name='Tag'),
  templateId?: string(name='TemplateId'),
}

model DescribeFlowTemplateResponse = {
  headers: map[string]string(name='headers'),
  body: DescribeFlowTemplateResponseBody(name='body'),
}

async function describeFlowTemplateWithOptions(request: DescribeFlowTemplateRequest, runtime: Util.RuntimeOptions): DescribeFlowTemplateResponse {
  Util.validateModel(request);
  var req = new OpenApi.OpenApiRequest{ 
    body = Util.toMap(request),
  };
  return doRPCRequest('DescribeFlowTemplate', '2018-12-12', 'HTTPS', 'POST', 'AK', 'json', req, runtime);
}

async function describeFlowTemplate(request: DescribeFlowTemplateRequest): DescribeFlowTemplateResponse {
  var runtime = new Util.RuntimeOptions{};
  return describeFlowTemplateWithOptions(request, runtime);
}

model DescribeInvocationLogRequest {
  invocationId?: string(name='InvocationId'),
  pages?: string(name='Pages'),
}

model DescribeInvocationLogResponseBody = {
  status?: string(name='Status'),
  parameters?: map[string]any(name='Parameters'),
  returnCode?: string(name='ReturnCode'),
  endTime?: long(name='EndTime'),
  requestId?: string(name='RequestId'),
  actions?: [ 
    {
      loopCount?: int32(name='LoopCount'),
      endTime?: long(name='EndTime'),
      status?: string(name='Status'),
      startTime?: long(name='StartTime'),
      invocationId?: string(name='InvocationId'),
      returnCode?: string(name='ReturnCode'),
      error?: {
        errorCode?: string(name='ErrorCode'),
        message?: string(name='Message'),
      }(name='Error'),
      outputsResult?: {
        contentType?: string(name='ContentType'),
        contentSize?: string(name='ContentSize'),
        url?: string(name='Url'),
      }(name='OutputsResult'),
      name?: string(name='Name'),
      inputsResult?: {
        contentType?: string(name='ContentType'),
        contentSize?: string(name='ContentSize'),
        url?: string(name='Url'),
      }(name='InputsResult'),
    }
  ](name='Actions'),
  timeoutTime?: long(name='TimeoutTime'),
  startTime?: long(name='StartTime'),
  workflow?: {
    definition?: string(name='Definition'),
    version?: string(name='Version'),
    flowId?: string(name='FlowId'),
  }(name='Workflow'),
  invocationError?: {
    errorCode?: string(name='ErrorCode'),
    message?: string(name='Message'),
  }(name='InvocationError'),
  trigger?: {
    endTime?: long(name='EndTime'),
    status?: string(name='Status'),
    startTime?: long(name='StartTime'),
    invocationId?: string(name='InvocationId'),
    returnCode?: string(name='ReturnCode'),
    error?: {
      errorCode?: string(name='ErrorCode'),
      message?: string(name='Message'),
    }(name='Error'),
    outputsResult?: {
      contentType?: string(name='ContentType'),
      contentSize?: string(name='ContentSize'),
      url?: string(name='Url'),
    }(name='OutputsResult'),
    name?: string(name='Name'),
    inputsResult?: {
      contentType?: string(name='ContentType'),
      contentSize?: string(name='ContentSize'),
      url?: string(name='Url'),
    }(name='InputsResult'),
  }(name='Trigger'),
  responseResult?: {
    contentType?: string(name='ContentType'),
    contentSize?: string(name='ContentSize'),
    url?: string(name='Url'),
  }(name='ResponseResult'),
  invocationId?: string(name='InvocationId'),
  outputsResult?: {
    contentType?: string(name='ContentType'),
    contentSize?: string(name='ContentSize'),
    url?: string(name='Url'),
  }(name='OutputsResult'),
}

model DescribeInvocationLogResponse = {
  headers: map[string]string(name='headers'),
  body: DescribeInvocationLogResponseBody(name='body'),
}

async function describeInvocationLogWithOptions(request: DescribeInvocationLogRequest, runtime: Util.RuntimeOptions): DescribeInvocationLogResponse {
  Util.validateModel(request);
  var req = new OpenApi.OpenApiRequest{ 
    body = Util.toMap(request),
  };
  return doRPCRequest('DescribeInvocationLog', '2018-12-12', 'HTTPS', 'POST', 'AK', 'json', req, runtime);
}

async function describeInvocationLog(request: DescribeInvocationLogRequest): DescribeInvocationLogResponse {
  var runtime = new Util.RuntimeOptions{};
  return describeInvocationLogWithOptions(request, runtime);
}

model DescribeMetricDetailRequest {
  metricName?: string(name='MetricName'),
  period?: string(name='Period'),
  startTime?: string(name='StartTime'),
  endTime?: string(name='EndTime'),
}

model DescribeMetricDetailResponseBody = {
  requestId?: string(name='RequestId'),
  datapoints?: [ 
    {
      value?: string(name='Value'),
      timestamp?: long(name='Timestamp'),
    }
  ](name='Datapoints'),
}

model DescribeMetricDetailResponse = {
  headers: map[string]string(name='headers'),
  body: DescribeMetricDetailResponseBody(name='body'),
}

async function describeMetricDetailWithOptions(request: DescribeMetricDetailRequest, runtime: Util.RuntimeOptions): DescribeMetricDetailResponse {
  Util.validateModel(request);
  var req = new OpenApi.OpenApiRequest{ 
    body = Util.toMap(request),
  };
  return doRPCRequest('DescribeMetricDetail', '2018-12-12', 'HTTPS', 'POST', 'AK', 'json', req, runtime);
}

async function describeMetricDetail(request: DescribeMetricDetailRequest): DescribeMetricDetailResponse {
  var runtime = new Util.RuntimeOptions{};
  return describeMetricDetailWithOptions(request, runtime);
}

model DisableFlowRequest {
  flowId?: string(name='FlowId'),
}

model DisableFlowResponseBody = {
  requestId?: string(name='RequestId'),
  success?: boolean(name='Success'),
}

model DisableFlowResponse = {
  headers: map[string]string(name='headers'),
  body: DisableFlowResponseBody(name='body'),
}

async function disableFlowWithOptions(request: DisableFlowRequest, runtime: Util.RuntimeOptions): DisableFlowResponse {
  Util.validateModel(request);
  var req = new OpenApi.OpenApiRequest{ 
    body = Util.toMap(request),
  };
  return doRPCRequest('DisableFlow', '2018-12-12', 'HTTPS', 'POST', 'AK', 'json', req, runtime);
}

async function disableFlow(request: DisableFlowRequest): DisableFlowResponse {
  var runtime = new Util.RuntimeOptions{};
  return disableFlowWithOptions(request, runtime);
}

model EnableFlowRequest {
  flowId?: string(name='FlowId'),
}

model EnableFlowResponseBody = {
  requestId?: string(name='RequestId'),
  success?: boolean(name='Success'),
}

model EnableFlowResponse = {
  headers: map[string]string(name='headers'),
  body: EnableFlowResponseBody(name='body'),
}

async function enableFlowWithOptions(request: EnableFlowRequest, runtime: Util.RuntimeOptions): EnableFlowResponse {
  Util.validateModel(request);
  var req = new OpenApi.OpenApiRequest{ 
    body = Util.toMap(request),
  };
  return doRPCRequest('EnableFlow', '2018-12-12', 'HTTPS', 'POST', 'AK', 'json', req, runtime);
}

async function enableFlow(request: EnableFlowRequest): EnableFlowResponse {
  var runtime = new Util.RuntimeOptions{};
  return enableFlowWithOptions(request, runtime);
}

model InvokeFlowRequest {
  flowId?: string(name='FlowId'),
  parameters?: string(name='Parameters'),
  data?: string(name='Data'),
  clientToken?: string(name='ClientToken'),
  definition?: string(name='Definition'),
}

model InvokeFlowResponseBody = {
  requestId?: string(name='RequestId'),
  invocationId?: string(name='InvocationId'),
  success?: boolean(name='Success'),
}

model InvokeFlowResponse = {
  headers: map[string]string(name='headers'),
  body: InvokeFlowResponseBody(name='body'),
}

async function invokeFlowWithOptions(request: InvokeFlowRequest, runtime: Util.RuntimeOptions): InvokeFlowResponse {
  Util.validateModel(request);
  var req = new OpenApi.OpenApiRequest{ 
    body = Util.toMap(request),
  };
  return doRPCRequest('InvokeFlow', '2018-12-12', 'HTTPS', 'POST', 'AK', 'json', req, runtime);
}

async function invokeFlow(request: InvokeFlowRequest): InvokeFlowResponse {
  var runtime = new Util.RuntimeOptions{};
  return invokeFlowWithOptions(request, runtime);
}

model ListConnectorsRequest {
  category?: string(name='Category'),
  lang?: string(name='Lang'),
}

model ListConnectorsResponseBody = {
  connectors?: [ 
    {
      displayName?: string(name='DisplayName'),
      capabilities?: [ string ](name='Capabilities'),
      parentConnector?: string(name='ParentConnector'),
      fullName?: string(name='FullName'),
      icon?: {
        type?: string(name='Type'),
        value?: string(name='Value'),
      }(name='Icon'),
      connectorId?: string(name='ConnectorId'),
      regionId?: string(name='RegionId'),
      description?: string(name='Description'),
      brandColor?: string(name='BrandColor'),
      category?: string(name='Category'),
      connectionParameters?: {
        type?: string(name='Type'),
      }(name='ConnectionParameters'),
      name?: string(name='Name'),
    }
  ](name='Connectors'),
  requestId?: string(name='RequestId'),
}

model ListConnectorsResponse = {
  headers: map[string]string(name='headers'),
  body: ListConnectorsResponseBody(name='body'),
}

async function listConnectorsWithOptions(request: ListConnectorsRequest, runtime: Util.RuntimeOptions): ListConnectorsResponse {
  Util.validateModel(request);
  var req = new OpenApi.OpenApiRequest{ 
    body = Util.toMap(request),
  };
  return doRPCRequest('ListConnectors', '2018-12-12', 'HTTPS', 'POST', 'AK', 'json', req, runtime);
}

async function listConnectors(request: ListConnectorsRequest): ListConnectorsResponse {
  var runtime = new Util.RuntimeOptions{};
  return listConnectorsWithOptions(request, runtime);
}

model ListConnectorTriggersRequest {
  category?: string(name='Category'),
  lang?: string(name='Lang'),
}

model ListConnectorTriggersResponseBody = {
  requestId?: string(name='RequestId'),
  triggers?: [ 
    {
      displayName?: string(name='DisplayName'),
      type?: string(name='Type'),
      visibility?: string(name='Visibility'),
      description?: string(name='Description'),
      documentUrl?: string(name='DocumentUrl'),
      connector?: {
        displayName?: string(name='DisplayName'),
        description?: string(name='Description'),
        fullName?: string(name='FullName'),
        brandColor?: string(name='BrandColor'),
        icon?: {
          type?: string(name='Type'),
          value?: string(name='Value'),
        }(name='Icon'),
        category?: string(name='Category'),
        name?: string(name='Name'),
        regionId?: string(name='RegionId'),
      }(name='Connector'),
      name?: string(name='Name'),
      system?: boolean(name='System'),
    }
  ](name='Triggers'),
}

model ListConnectorTriggersResponse = {
  headers: map[string]string(name='headers'),
  body: ListConnectorTriggersResponseBody(name='body'),
}

async function listConnectorTriggersWithOptions(request: ListConnectorTriggersRequest, runtime: Util.RuntimeOptions): ListConnectorTriggersResponse {
  Util.validateModel(request);
  var req = new OpenApi.OpenApiRequest{ 
    body = Util.toMap(request),
  };
  return doRPCRequest('ListConnectorTriggers', '2018-12-12', 'HTTPS', 'POST', 'AK', 'json', req, runtime);
}

async function listConnectorTriggers(request: ListConnectorTriggersRequest): ListConnectorTriggersResponse {
  var runtime = new Util.RuntimeOptions{};
  return listConnectorTriggersWithOptions(request, runtime);
}

model ListFlowRequest {
  pageSize?: int32(name='PageSize'),
  pageNumber?: int32(name='PageNumber'),
  name?: string(name='Name'),
}

model ListFlowResponseBody = {
  totalCount?: int32(name='TotalCount'),
  totalPage?: int32(name='TotalPage'),
  requestId?: string(name='RequestId'),
  flows?: [ 
    {
      status?: string(name='Status'),
      prodVersion?: int32(name='ProdVersion'),
      description?: string(name='Description'),
      createdAt?: string(name='CreatedAt'),
      currentVersion?: int32(name='CurrentVersion'),
      editMode?: string(name='EditMode'),
      updatedAt?: string(name='UpdatedAt'),
      source?: string(name='Source'),
      name?: string(name='Name'),
      flowId?: string(name='FlowId'),
    }
  ](name='Flows'),
}

model ListFlowResponse = {
  headers: map[string]string(name='headers'),
  body: ListFlowResponseBody(name='body'),
}

async function listFlowWithOptions(request: ListFlowRequest, runtime: Util.RuntimeOptions): ListFlowResponse {
  Util.validateModel(request);
  var req = new OpenApi.OpenApiRequest{ 
    body = Util.toMap(request),
  };
  return doRPCRequest('ListFlow', '2018-12-12', 'HTTPS', 'POST', 'AK', 'json', req, runtime);
}

async function listFlow(request: ListFlowRequest): ListFlowResponse {
  var runtime = new Util.RuntimeOptions{};
  return listFlowWithOptions(request, runtime);
}

model ListFlowConnectionsRequest {
  flowId?: string(name='FlowId'),
}

model ListFlowConnectionsResponseBody = {
  connections?: [ 
    {
      definition?: string(name='Definition'),
      actions?: [ 
        {
          type?: string(name='Type'),
          actionName?: string(name='ActionName'),
        }
      ](name='Actions'),
      connectionName?: string(name='ConnectionName'),
      connector?: {
        displayName?: string(name='DisplayName'),
        brandColor?: string(name='BrandColor'),
        icon?: {
          type?: string(name='Type'),
          value?: string(name='Value'),
        }(name='Icon'),
        name?: string(name='Name'),
        connectionParameters?: {
          type?: string(name='Type'),
        }(name='ConnectionParameters'),
      }(name='Connector'),
      content?: string(name='Content'),
    }
  ](name='Connections'),
  requestId?: string(name='RequestId'),
}

model ListFlowConnectionsResponse = {
  headers: map[string]string(name='headers'),
  body: ListFlowConnectionsResponseBody(name='body'),
}

async function listFlowConnectionsWithOptions(request: ListFlowConnectionsRequest, runtime: Util.RuntimeOptions): ListFlowConnectionsResponse {
  Util.validateModel(request);
  var req = new OpenApi.OpenApiRequest{ 
    body = Util.toMap(request),
  };
  return doRPCRequest('ListFlowConnections', '2018-12-12', 'HTTPS', 'POST', 'AK', 'json', req, runtime);
}

async function listFlowConnections(request: ListFlowConnectionsRequest): ListFlowConnectionsResponse {
  var runtime = new Util.RuntimeOptions{};
  return listFlowConnectionsWithOptions(request, runtime);
}

model ListFlowTemplateRequest {
  pageNumber?: int32(name='PageNumber'),
  pageSize?: int32(name='PageSize'),
  name?: string(name='Name'),
  tag?: string(name='Tag'),
  lang?: string(name='Lang'),
}

model ListFlowTemplateResponseBody = {
  totalPage?: int32(name='TotalPage'),
  requestId?: string(name='RequestId'),
  flowTemplates?: [ 
    {
      summary?: string(name='Summary'),
      locale?: string(name='Locale'),
      summaryEn?: string(name='SummaryEn'),
      createdAt?: string(name='CreatedAt'),
      overview?: string(name='Overview'),
      connector?: string(name='Connector'),
      tag?: string(name='Tag'),
      creator?: string(name='Creator'),
      description?: string(name='Description'),
      version?: int32(name='Version'),
      updatedAt?: string(name='UpdatedAt'),
      name?: string(name='Name'),
      templateId?: string(name='TemplateId'),
    }
  ](name='FlowTemplates'),
}

model ListFlowTemplateResponse = {
  headers: map[string]string(name='headers'),
  body: ListFlowTemplateResponseBody(name='body'),
}

async function listFlowTemplateWithOptions(request: ListFlowTemplateRequest, runtime: Util.RuntimeOptions): ListFlowTemplateResponse {
  Util.validateModel(request);
  var req = new OpenApi.OpenApiRequest{ 
    body = Util.toMap(request),
  };
  return doRPCRequest('ListFlowTemplate', '2018-12-12', 'HTTPS', 'POST', 'AK', 'json', req, runtime);
}

async function listFlowTemplate(request: ListFlowTemplateRequest): ListFlowTemplateResponse {
  var runtime = new Util.RuntimeOptions{};
  return listFlowTemplateWithOptions(request, runtime);
}

model ListFlowTriggersRequest {
  flowId?: string(name='FlowId'),
}

model ListFlowTriggersResponseBody = {
  requestId?: string(name='RequestId'),
  triggers?: [ 
    {
      triggerName?: string(name='TriggerName'),
      endpoint?: string(name='Endpoint'),
      actionsCount?: int32(name='ActionsCount'),
      triggerActionName?: string(name='TriggerActionName'),
      triggerDescription?: string(name='TriggerDescription'),
      triggerActionDescription?: string(name='TriggerActionDescription'),
      triggerType?: string(name='TriggerType'),
    }
  ](name='Triggers'),
}

model ListFlowTriggersResponse = {
  headers: map[string]string(name='headers'),
  body: ListFlowTriggersResponseBody(name='body'),
}

async function listFlowTriggersWithOptions(request: ListFlowTriggersRequest, runtime: Util.RuntimeOptions): ListFlowTriggersResponse {
  Util.validateModel(request);
  var req = new OpenApi.OpenApiRequest{ 
    body = Util.toMap(request),
  };
  return doRPCRequest('ListFlowTriggers', '2018-12-12', 'HTTPS', 'POST', 'AK', 'json', req, runtime);
}

async function listFlowTriggers(request: ListFlowTriggersRequest): ListFlowTriggersResponse {
  var runtime = new Util.RuntimeOptions{};
  return listFlowTriggersWithOptions(request, runtime);
}

model ListFlowVersionRequest {
  flowId?: string(name='FlowId'),
  pageNumber?: int32(name='PageNumber'),
  pageSize?: int32(name='PageSize'),
}

model ListFlowVersionResponseBody = {
  versions?: [ 
    {
      version?: int32(name='Version'),
      state?: int32(name='State'),
      versionId?: string(name='VersionId'),
      createdAt?: string(name='CreatedAt'),
      updatedAt?: string(name='UpdatedAt'),
      flowId?: string(name='FlowId'),
    }
  ](name='Versions'),
  totalPage?: int32(name='TotalPage'),
  requestId?: string(name='RequestId'),
}

model ListFlowVersionResponse = {
  headers: map[string]string(name='headers'),
  body: ListFlowVersionResponseBody(name='body'),
}

async function listFlowVersionWithOptions(request: ListFlowVersionRequest, runtime: Util.RuntimeOptions): ListFlowVersionResponse {
  Util.validateModel(request);
  var req = new OpenApi.OpenApiRequest{ 
    body = Util.toMap(request),
  };
  return doRPCRequest('ListFlowVersion', '2018-12-12', 'HTTPS', 'POST', 'AK', 'json', req, runtime);
}

async function listFlowVersion(request: ListFlowVersionRequest): ListFlowVersionResponse {
  var runtime = new Util.RuntimeOptions{};
  return listFlowVersionWithOptions(request, runtime);
}

model ListInvocationLogsRequest {
  flowId?: string(name='FlowId', description='工作流 ID'),
  pageNumber?: int32(name='PageNumber', description='页码'),
  pageSize?: int32(name='PageSize', description='每页返回数量'),
  status?: string(name='Status', description='执行状态'),
  flowVersion?: string(name='FlowVersion', description='工作流版本'),
  startTime?: string(name='StartTime', description='执行开始时间'),
  endTime?: string(name='EndTime', description='结束执行时间'),
  tags?: string(name='Tags', description='标签'),
}

model ListInvocationLogsResponseBody = {
  totalPage?: long(name='TotalPage', description='总页数'),
  requestId?: string(name='RequestId', description='请求 ID'),
  logs?: [ 
    {
      status?: string(name='Status', description='执行状态'),
      endTime?: string(name='EndTime', description='执行完成时间'),
      startTime?: string(name='StartTime', description='开始执行时间'),
      invocationId?: string(name='InvocationId', description='执行唯一标识符'),
      returnCode?: string(name='ReturnCode', description='返回码'),
      invocationError?: {
        errorCode?: string(name='ErrorCode'),
        message?: string(name='Message'),
      }(name='InvocationError', description='错误信息'),
      workflow?: {
        definition?: string(name='Definition', description='工作流定义'),
        version?: string(name='Version', description='工作流版本'),
        flowId?: string(name='FlowId', description='工作流 ID'),
      }(name='Workflow', description='工作流详情'),
      tags?: [ 
        {
          key?: string(name='Key', description='标签名'),
          value?: string(name='Value', description='标签值'),
        }
      ](name='Tags', description='本次执行的标签'),
    }
  ](name='Logs', description='日志列表'),
  totalCount?: long(name='TotalCount', description='总数'),
}

model ListInvocationLogsResponse = {
  headers: map[string]string(name='headers'),
  body: ListInvocationLogsResponseBody(name='body'),
}

async function listInvocationLogsWithOptions(request: ListInvocationLogsRequest, runtime: Util.RuntimeOptions): ListInvocationLogsResponse {
  Util.validateModel(request);
  var req = new OpenApi.OpenApiRequest{ 
    body = Util.toMap(request),
  };
  return doRPCRequest('ListInvocationLogs', '2018-12-12', 'HTTPS', 'POST', 'AK', 'json', req, runtime);
}

async function listInvocationLogs(request: ListInvocationLogsRequest): ListInvocationLogsResponse {
  var runtime = new Util.RuntimeOptions{};
  return listInvocationLogsWithOptions(request, runtime);
}

model ListTagResponseBody = {
  requestId?: string(name='RequestId'),
  tags?: [ 
    {
      createdAt?: string(name='CreatedAt'),
      name?: string(name='Name'),
      id?: int32(name='Id'),
      count?: int32(name='Count'),
    }
  ](name='Tags'),
}

model ListTagResponse = {
  headers: map[string]string(name='headers'),
  body: ListTagResponseBody(name='body'),
}

async function listTagWithOptions(runtime: Util.RuntimeOptions): ListTagResponse {
  var req = new OpenApi.OpenApiRequest{};
  return doRPCRequest('ListTag', '2018-12-12', 'HTTPS', 'POST', 'AK', 'json', req, runtime);
}

async function listTag(): ListTagResponse {
  var runtime = new Util.RuntimeOptions{};
  return listTagWithOptions(runtime);
}

model ModifyFlowRequest {
  flowId?: string(name='FlowId'),
  name?: string(name='Name'),
  description?: string(name='Description'),
  definition?: string(name='Definition'),
  flowRole?: string(name='FlowRole'),
}

model ModifyFlowResponseBody = {
  requestId?: string(name='RequestId'),
}

model ModifyFlowResponse = {
  headers: map[string]string(name='headers'),
  body: ModifyFlowResponseBody(name='body'),
}

async function modifyFlowWithOptions(request: ModifyFlowRequest, runtime: Util.RuntimeOptions): ModifyFlowResponse {
  Util.validateModel(request);
  var req = new OpenApi.OpenApiRequest{ 
    body = Util.toMap(request),
  };
  return doRPCRequest('ModifyFlow', '2018-12-12', 'HTTPS', 'POST', 'AK', 'json', req, runtime);
}

async function modifyFlow(request: ModifyFlowRequest): ModifyFlowResponse {
  var runtime = new Util.RuntimeOptions{};
  return modifyFlowWithOptions(request, runtime);
}

model RollBackFlowRequest {
  flowId?: string(name='FlowId'),
}

model RollBackFlowResponseBody = {
  requestId?: string(name='RequestId'),
}

model RollBackFlowResponse = {
  headers: map[string]string(name='headers'),
  body: RollBackFlowResponseBody(name='body'),
}

async function rollBackFlowWithOptions(request: RollBackFlowRequest, runtime: Util.RuntimeOptions): RollBackFlowResponse {
  Util.validateModel(request);
  var req = new OpenApi.OpenApiRequest{ 
    body = Util.toMap(request),
  };
  return doRPCRequest('RollBackFlow', '2018-12-12', 'HTTPS', 'POST', 'AK', 'json', req, runtime);
}

async function rollBackFlow(request: RollBackFlowRequest): RollBackFlowResponse {
  var runtime = new Util.RuntimeOptions{};
  return rollBackFlowWithOptions(request, runtime);
}

model UpdateConnectionRequest {
  connector?: string(name='Connector'),
  connectionName?: string(name='ConnectionName'),
  connectionContent?: string(name='ConnectionContent'),
  actionType?: string(name='ActionType'),
  connectionType?: string(name='ConnectionType'),
}

model UpdateConnectionResponseBody = {
  connectionName?: string(name='ConnectionName'),
  connectionId?: string(name='ConnectionId'),
  requestId?: string(name='RequestId'),
  content?: string(name='Content'),
  definition?: string(name='Definition'),
}

model UpdateConnectionResponse = {
  headers: map[string]string(name='headers'),
  body: UpdateConnectionResponseBody(name='body'),
}

async function updateConnectionWithOptions(request: UpdateConnectionRequest, runtime: Util.RuntimeOptions): UpdateConnectionResponse {
  Util.validateModel(request);
  var req = new OpenApi.OpenApiRequest{ 
    body = Util.toMap(request),
  };
  return doRPCRequest('UpdateConnection', '2018-12-12', 'HTTPS', 'POST', 'AK', 'json', req, runtime);
}

async function updateConnection(request: UpdateConnectionRequest): UpdateConnectionResponse {
  var runtime = new Util.RuntimeOptions{};
  return updateConnectionWithOptions(request, runtime);
}

